home *** CD-ROM | disk | FTP | other *** search
/ Personal Computer World 2005 October / PCWOCT05.iso / Software / FromTheMag / The GIMP 2.2.8 / gimp-2.2.8-i586-setup.exe / {app} / share / gimp / 2.0 / scripts / alien-glow-bullet.scm < prev    next >
Encoding:
Text File  |  2005-06-30  |  3.6 KB  |  109 lines

  1. ; The GIMP -- an image manipulation program
  2. ; Copyright (C) 1995 Spencer Kimball and Peter Mattis
  3. ; Alien Glow themed bullets for web pages
  4. ; Copyright (c) 1997 Adrian Likins
  5. ; aklikins@eos.ncsu.edu 
  6. ;
  7. ; This program is free software; you can redistribute it and/or modify
  8. ; it under the terms of the GNU General Public License as published by
  9. ; the Free Software Foundation; either version 2 of the License, or
  10. ; (at your option) any later version.
  11. ; This program is distributed in the hope that it will be useful,
  12. ; but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  14. ; GNU General Public License for more details.
  15. ; You should have received a copy of the GNU General Public License
  16. ; along with this program; if not, write to the Free Software
  17. ; Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  18.  
  19. (define (center-ellipse img
  20.             cx
  21.             cy
  22.             rx
  23.             ry
  24.             op
  25.             aa
  26.             feather
  27.             frad)
  28.   (gimp-ellipse-select img (- cx rx) (- cy ry) (+ rx rx) (+ ry ry)
  29.                op aa feather frad))
  30.  
  31.  
  32. (define (script-fu-alien-glow-bullet radius
  33.                      glow-color
  34.                      bg-color
  35.                      flatten)
  36.   (let* ((img (car (gimp-image-new radius radius RGB)))
  37.      (border (/ radius 4))
  38.      (diameter (* radius 2))
  39.      (half-radius (/ radius 2))
  40.      (blend-start (+ half-radius (/ half-radius 2)))
  41.      (bullet-layer (car (gimp-layer-new img
  42.                         diameter diameter RGBA-IMAGE
  43.                         "Ruler" 100 NORMAL-MODE)))
  44.      (glow-layer (car (gimp-layer-new img diameter diameter RGBA-IMAGE
  45.                       "ALien Glow" 100 NORMAL-MODE)))
  46.      (bg-layer (car (gimp-layer-new img diameter diameter RGB-IMAGE
  47.                     "Background" 100 NORMAL-MODE))))
  48.  
  49.     (gimp-context-push)
  50.  
  51.     (gimp-image-undo-disable img)
  52.     (gimp-image-resize img diameter diameter 0 0)
  53.     (gimp-image-add-layer img bg-layer 1)
  54.     (gimp-image-add-layer img glow-layer -1)
  55.     (gimp-image-add-layer img bullet-layer -1)
  56.  
  57.     ; (gimp-layer-set-preserve-trans ruler-layer TRUE)
  58.     (gimp-context-set-background bg-color)
  59.     (gimp-edit-fill bg-layer BACKGROUND-FILL)
  60.     (gimp-edit-clear glow-layer)
  61.     (gimp-edit-clear bullet-layer)
  62.  
  63.     (center-ellipse img radius radius half-radius half-radius
  64.             CHANNEL-OP-REPLACE TRUE FALSE 0)
  65.     
  66.     ; (gimp-rect-select img (/ height 2) (/ height 2) length height CHANNEL-OP-REPLACE FALSE 0)
  67.     (gimp-context-set-foreground '(90 90 90))
  68.     (gimp-context-set-background '(0 0 0))
  69.  
  70.     (gimp-edit-blend bullet-layer FG-BG-RGB-MODE NORMAL-MODE
  71.              GRADIENT-RADIAL 100 0 REPEAT-NONE FALSE
  72.              FALSE 0 0 TRUE
  73.              blend-start blend-start
  74.              (+ half-radius radius) (+ half-radius radius))
  75.  
  76.     (gimp-context-set-foreground glow-color)
  77.     (gimp-selection-grow img border)
  78.     (gimp-selection-feather img  border)
  79.     (gimp-edit-fill glow-layer FOREGROUND-FILL)
  80.     (gimp-selection-none img)
  81.     (if (>= radius 16)
  82.     (plug-in-gauss-rle 1 img glow-layer 25 TRUE TRUE)
  83.     (plug-in-gauss-rle 1 img glow-layer 12 TRUE TRUE))
  84.  
  85.     (if (= flatten TRUE)
  86.     (gimp-image-flatten img))
  87.     (gimp-image-undo-enable img)
  88.     (gimp-display-new img)
  89.  
  90.     (gimp-context-pop)))
  91.  
  92. (script-fu-register "script-fu-alien-glow-bullet"
  93.             _"_Bullet..."
  94.             "Create a Bullet with an Alien Glow theme for web pages"
  95.             "Adrian Likins"
  96.             "Adrian Likins"
  97.             "1997"
  98.             ""
  99.             SF-ADJUSTMENT _"Radius"           '(16 1 100 1 10 0 1)
  100.             SF-COLOR      _"Glow color"       '(63 252 0)
  101.             SF-COLOR      _"Background color" '(0 0 0)
  102.             SF-TOGGLE     _"Flatten image"    TRUE)
  103.  
  104. (script-fu-menu-register "script-fu-alien-glow-bullet"
  105.              _"<Toolbox>/Xtns/Script-Fu/Web Page Themes/Alien Glow")
  106.